-
Notifications
You must be signed in to change notification settings - Fork 715
Create xDSL universe for the unified compiler #8372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hello. You may have forgotten to update the changelog!
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8372 +/- ##
=======================================
Coverage 99.42% 99.42%
=======================================
Files 587 587
Lines 61547 61547
=======================================
Hits 61196 61196
Misses 351 351 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mehrdad2m
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 🥳
andrijapau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - thanks for walking me through it.
| try: | ||
| from xdsl.passes import ModulePass | ||
| from xdsl.universe import Universe | ||
| except (ImportError, ModuleNotFoundError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| except (ImportError, ModuleNotFoundError): | |
| except ModuleNotFoundError: |
Can we just keep this ModuleNotFoundError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ModuleNotFoundError is for when a package is not installed, but ImportError is for when a package is installed from you're trying to import something from it that doesn't exist. This is a way to future proof the file, so that if xDSL gets reorganized, we don't see ImportErrors. I'd rather just leave it as is.
|
Tried building wheels in a fresh environment without jax or xdsl installed. The wheels built fine, and pennylane can be imported without any issues. An error gets raised if I try to load the plugin: >>> import pennylane as qml
>>> from importlib.metadata import entry_points
>>> plugins = entry_points(group="xdsl.universe")
>>> plugin = None
>>> for p in plugins:
... if p.name == "pennylane-xdsl-universe:
... plugin = p
... break
...
>>> plugin.load()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mudit.pandey/.pyenv/versions/3.12.11/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mudit.pandey/.pyenv/versions/3.12.11/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Users/mudit.pandey/repos/pennylane/pennylane/compiler/python_compiler/__init__.py", line 16, in <module>
from .compiler import Compiler
File "/Users/mudit.pandey/repos/pennylane/pennylane/compiler/python_compiler/compiler.py", line 19, in <module>
from jax._src.interpreters import mlir
ModuleNotFoundError: No module named 'jax'Had a discussion with Lee, and the conclusion is that raising an error when trying to load the plugin without the correct dependencies installed (jax and xdsl) is fine, but a better error message should be used. I will hold off on merging for now, and we can resolve this if it becomes a blocker, which it isn't right now. |
|
Closing in favour of PennyLaneAI/catalyst#2208 |
xDSL has a
Universeclass, which can be used to create entry points that expose custom dialects and passes to tools likexdsl-opt,xdsl-gui. This PR creates theUniverseinstance and adds it as an entry point topyproject.tomlthat xDSL can use.Notes:
transformandstablehlodialects, I've temporarily skipped their addition to ourUniverseinstance.[sc-100654]